#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "client.h"

int net_init (const char* server_ip)
{
	sock_fd = socket(AF_INET, SOCK_STREAM, 0);
	sock_fd2 = socket(AF_INET, SOCK_STREAM, 0);

	struct sockaddr_in s_addr;
	s_addr.sin_family = AF_INET;
	s_addr.sin_addr.s_addr = inet_addr(server_ip);
	s_addr.sin_port = htons(SERVER_PORT);

	if ( connect(sock_fd, (struct sockaddr *) &s_addr, sizeof (s_addr)) == -1)
		sock_fd = -1;

	if ( connect(sock_fd2, (struct sockaddr *) &s_addr, sizeof (s_addr)) == -1)
		sock_fd2 = -1;

	return (sock_fd & sock_fd2);
}
